package com.my.h2.test;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author timo 2021/3/4
 */
@RestController
@RequestMapping("h2jpatest")
@Slf4j
public class H2JpaController {

    @Autowired
    private H2Dao h2Dao;

    @GetMapping("/list")
    public List<User> findAll(){
        return h2Dao.findAll();
    }
    @RequestMapping("/save")
    public Boolean save(@RequestBody User user){
        h2Dao.save(user);
        return Boolean.TRUE;
    }

}
